package com.sikaryofficial.backend.loader;

import com.sikaryofficial.backend.annotation.TenantFilter;
import com.sikaryofficial.backend.service.store.StoreCacheService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

/**
 * @author : qinjinyuan
 * @desc : 店铺点位数据预热
 * @date : 2023/11/28 8:59
 */
@Component
@Slf4j
public class StorePointLoader implements CommandLineRunner {
    @Autowired
    private StoreCacheService storeCacheService;
    @Value("${hismk.backend.loader.storePoint}")
    private boolean loadFlag;

    @Override
    @TenantFilter
    public void run(String... args) {
        if (Boolean.TRUE.equals(loadFlag)) {
            log.info("start: 店铺点位数据预热=================================");
            storeCacheService.loadAllStorePoint();
            log.info("end:  店铺点位数据预热=================================");
        }
    }
}
